package com.yanqu.road.server.cmd.chefduel.process2;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.chefduel.ChefDuelProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.chefduel.CrossChefDuelMgr;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Protocol.C_CROSS_CHEF_DUEL2_SELECT_CAMP, desc = "阵营选择")
public class CrossChefDuel2CampSelectCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        ChefDuelProto.ChefDuel2CampSelectReqMsg reqMsg = ChefDuelProto.ChefDuel2CampSelectReqMsg.parseFrom(packet.getBytes());
        ret = CrossChefDuelMgr.selectCampId(reqMsg.getActivityId(), serverId, packet.getPlayerId(), reqMsg.getCampId());

        if(ret != 0){
            MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.U_CHEF_DUEL2_SELECT_CAMP, ChefDuelProto.ChefDuel2CampSelectRespMsg.newBuilder().setRet(ret)));
        }
    }

    @Override
    public void sendData() {
    }
}
